package com.coolbi.onsupai.core.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.dao.TransportModeDao;
import com.coolbi.onsupai.core.entity.TransportMode;
import com.coolbi.onsupai.core.mapper.TransportModeMapper;

public class TransportModeDaoImpl implements TransportModeDao {

	@Autowired
	private TransportModeMapper transportModeMapper;
	
	@Override
	public TransportMode save(TransportMode obj) {
		transportModeMapper.save(obj);
		return obj;
	}

	@Override
	public int delete(long id) {
		return transportModeMapper.delete(id);
	}

	@Override
	public int update(TransportMode obj) {
		return transportModeMapper.update(obj);
	}

	@Override
	public TransportMode get(long id) {
		return transportModeMapper.get(id);
	}

	@Override
	public List<TransportMode> list() {
		return transportModeMapper.list();
	}

	@Override
	public List<TransportMode> listByPage(int offset, int limit) {
		Map<String, Object> parameter = new HashMap<String, Object>();
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return transportModeMapper.listByPage(parameter);
	}

	@Override
	public List<TransportMode> find(Map<String, Object> parameter) {
		return transportModeMapper.listByParameter(parameter);
	}

	@Override
	public List<TransportMode> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return transportModeMapper.listByParameterPage(parameter);
	}

	@Override
	public List<TransportMode> search(Map<String, Object> parameter,
			int offset, int limit) {
		parameter.put("offset", offset);
		parameter.put("limit", limit);
		return transportModeMapper.search(parameter);
	}

	@Override
	public int count() {
		return transportModeMapper.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return transportModeMapper.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return transportModeMapper.countByParameter(parameter);
	}

	public void setTransportModeMapper(TransportModeMapper transportModeMapper) {
		this.transportModeMapper = transportModeMapper;
	}

}
